package top.tervest.easyshare.service.impl;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import top.tervest.easyshare.common.util.AuthUtil;
import top.tervest.easyshare.domain.param.LoginParam;
import top.tervest.easyshare.domain.param.RegisterParam;
import top.tervest.easyshare.service.UserService;

import javax.annotation.Resource;

/**
 * @author ZhangNanNan
 * @create 2019-07-17 11:16
 */
@Service
public class UserServiceImpl implements UserService {




    @Override
    public String login(LoginParam param) {
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(param.getUsername(),param.getPassword());
        String auth = AuthUtil.auth(token);
        return auth;
    }

    @Override
    public String register(RegisterParam param) {
        return "success";
    }
}
